<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Search extends FOX_Controller {

	function __construct ()
	{
		parent::__construct();
		$this->load->model('category_m');
		$this->load->model('api_good_m');
		$this->load->model('member_m');
		$this->load->model('good_m');
		$this->load->model('shop_m');
		$this->load->model('areas_m');
		$this->load->model('search_m');
	}
	public function index()
	{
		// 获取热门分类
		$user_id = $this->session->userdata('user_id');
		if($user_id){
			$hot = $this->search_m->get_hot_categorys(5,$user_id);
		}else{
			$hot = $this->search_m->get_hot_categorys(5);
		}
        
        if(!empty($hot)){
            foreach ($hot as $key=>$val){
                $hot[$key]["link"] = site_url("goods/flist/".$val['id']);
            }
        }
        $data['hot'] =$hot;
        $this->load->view('search',$data);
	}

}
